﻿#r @"..\Microsoft.SharePoint.Client (spo)\Microsoft.SharePoint.Client.dll"
#r @"..\Microsoft.SharePoint.Client (spo)\Microsoft.SharePoint.Client.Runtime.dll"

#load "Client.fs"

open Client
open Microsoft.SharePoint.Client
open Microsoft.SharePoint.Client.Application
open System.Security;

// =======================================================
// Test CAML queries
// =======================================================

let list = Client.Context.Web.Lists.GetByTitle("Access Requests")

Client.Load list

let query = CamlQuery.CreateAllItemsQuery()
query.ViewXml <- 
    @"<View><Query>
        <Where>
            <And>
                <Neq><FieldRef Name=""RequestedListItemId"" /><Value Type=""Guid"">00000000-0000-0000-0000-000000000000</Value></Neq>
                <Eq><FieldRef Name=""Status"" /><Value Type=""Integer"">0</Value></Eq>
            </And>
        </Where>
    </Query></View>"

let items = list.GetItems(query)
Client.Load items

items.Count
